/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dominio;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 *
 * @author jair
 */
@Entity
@Table(name = "Turma_Disciplina")
public class TurmaDisciplina implements Serializable {
    private static final long serialVersionUID = 1L;
 
    @Id
    @NotNull
    @Column(name = "ID_Turma_Disciplina")
    private Integer id;
   
    @NotNull
    @Column(name = "CH")
    private int ch;
    
    @Column(name = "RepNota")
    private Character repNota;
    
    @Column(name = "RepFalta")
    private Character repFalta;
    
    @Column(name = "ordemimpressao")
    private Integer ordemimpressao;
    
    @OneToMany(mappedBy = "turmaDisciplina", fetch = FetchType.LAZY)
    private Set<Notas> notas = new HashSet<>();

    @ManyToOne()
    @JoinColumn(name = "codigo_disciplina")
    private Disciplinas disciplinas;
    
    @ManyToOne()
    @JoinColumn(name = "codigo_Professor")
    private Professores professor;
     
    @ManyToOne()
    @JoinColumn(name = "codigo_Turma")
    private Turmas turmas;
     
    @OneToMany(mappedBy = "turmaDisciplina", fetch = FetchType.LAZY)
    private Set<Avaliacao> avaliacao = new HashSet<>();

    public TurmaDisciplina() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getCh() {
        return ch;
    }

    public void setCh(int ch) {
        this.ch = ch;
    }

    public Character getRepNota() {
        return repNota;
    }

    public void setRepNota(Character repNota) {
        this.repNota = repNota;
    }

    public Character getRepFalta() {
        return repFalta;
    }

    public void setRepFalta(Character repFalta) {
        this.repFalta = repFalta;
    }

    public Integer getOrdemimpressao() {
        return ordemimpressao;
    }

    public void setOrdemimpressao(Integer ordemimpressao) {
        this.ordemimpressao = ordemimpressao;
    }

    public Set<Notas> getNotas() {
        return notas;
    }

    public void setNotas(Set<Notas> notas) {
        this.notas = notas;
    }

    public Disciplinas getDisciplinas() {
        return disciplinas;
    }

    public void setDisciplinas(Disciplinas disciplinas) {
        this.disciplinas = disciplinas;
    }

    public Professores getProfessor() {
        return professor;
    }

    public void setProfessor(Professores professor) {
        this.professor = professor;
    }

    public Turmas getTurmas() {
        return turmas;
    }

    public void setTurmas(Turmas turmas) {
        this.turmas = turmas;
    }

    public Set<Avaliacao> getAvaliacao() {
        return avaliacao;
    }

    public void setAvaliacao(Set<Avaliacao> avaliacao) {
        this.avaliacao = avaliacao;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + Objects.hashCode(this.id);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TurmaDisciplina other = (TurmaDisciplina) obj;
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        return true;
    }

}
